﻿package net.wangit.jdbc;

import java.io.Serializable;

import net.wangit.jdbc.database.Database;
import net.wangit.jdbc.sqltype.SqlType;


/**
 * 字段类型，统一处理各数据库的字段区别。
 * 
 * @author watson Feb 12, 2010
 */
public interface Type extends Serializable {

	public static final int CHAR = 1;// 定长字符
	public static final int VARCHAR = 2;// 变长字符
	public static final int SMALLINT = 11;// 短整数
	public static final int INTEGER = 12;// 整数
	public static final int BIGINT = 13;// 长整数
	public static final int FLOAT = 21;// 单精度浮点
	public static final int DOUBLE = 22;// 双精度浮点
	public static final int DECIMAL = 23;// 长小数
	public static final int DATE = 31;// 日期
	public static final int TIME = 32;// 时间
	public static final int TIMESTAMP = 33;// 日期时间
	public static final int CLOB = 41;// 字符型大对象
	public static final int BLOB = 43;// 二进制型大对象

	public abstract int code();

	public abstract String formatInput(String value);

	public abstract String formatValue(String value);

	public abstract String getSqlTypeName(Database database);

	public abstract String getTypeName();

	public abstract SqlType toSqlType(Database database);
}
